package domain.itf;

import java.util.List;

import util.DAOException;
import util.VersionException;
import domain.Address;

public interface IDAOAddress {
	
	/**
	 * Get an {@link Address} by id.
	 * 
	 * @param id
	 * @return the {@link Address} corresponding with this id.
	 * @throws {@link DAOException}
	 */
	public Address getById(Integer id) throws DAOException;
	
	/**
	 * Get all {@link Address}.
	 * 
	 * @return the {@link Address} corresponding with this id.
	 * @throws {@link DAOException}
	 */
	public List<Address> getAllAddress() throws DAOException;
	
	/**
	 * Add a new {@link Address}.
	 * @param street
	 * @param city
	 * @param zip
	 * @param country
	 * @return
	 * @throws {@link DAOException}
	 */
	public Address addAddress(String street, String city, String zip, String country) throws DAOException;

	/**
	 * Add a new {@link Address}.
	 * 
	 * @param address the address.
	 * @return the {@link Address} created in database.
	 * @throws {@link DAOException}
	 */
	public Address addAddress(Address address) throws DAOException;
	
	/**
	 * Update an {@link Address}.
	 * @param id
	 * @param version
	 * @param street
	 * @param city
	 * @param zip
	 * @param country
	 * @return
	 * @throws {@link DAOException}
	 * @throws {@link VersionException}
	 */
	public Address updateAddress(int id, long version, String street, String city,
			String zip, String country) throws DAOException, VersionException;

	/**
	 * Update an {@link Address}.
	 * 
	 * @param address 
	 * @return the {@link Address} updated.
	 * @throws {@link DAOException}
	 * @throws {@link VersionException}
	 */
	public Address updateAddress(Address address) throws DAOException, VersionException;

	/**
	 * Delete an {@link Address} from the database.
	 * 
	 * @param id
	 *            the id of the {@link Address} to delete.
	 * @return true if the delete success.
	 * @throws {@link DAOException}
	 */
	public boolean deleteAddress(int id) throws DAOException;
}
